﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Cqrs.Infrastructure.Database;
using Cqrs.StateMachineDesigner.CustomCode;
using Cqrs.Infrastructure;
using Ninject;
using System.Windows;

namespace Cqrs.StateMachineDesigner.Database
{
    public static class EventStoreInstance
    {
        private static IEventStore _instance;
        public static IEventStore Instance
        {
            get
            {
                if (_instance == null)
                {
                    //_instance = new EventStore.RavenDb(DBLocation, new EventPublisher(), false);
                    _instance = NinjectBinder.NinjectKernel.Get<IEventStore>();
                }
                return _instance;
            }
        }

        public static string HandleEventStoreError(Exception ex)
        {
            string message = ex.Message;
            if (ex.InnerException != null)
            {
                message += "\n" + ex.InnerException.Message;
            }
            return message;
        }
    }
}
